<!--#include file="lib/utf-8.asp"-->
<!--#include file="lib/connopen.asp"-->
<!--#include file="lib/asp-common-lib.asp"-->
<!--#include file="lib/dict_col.asp"-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>客户关系管理及报关单统计系统</title><!--#include file="lib/plugins.asp"-->
<style type="text/css">
	.ui-datepicker table {
		border: 0;
	}
	thead th{
		text-align:center;
		background:#e0e0e0;
	}
	tbody th[scope="row"],tbody th.sub{
		text-align:center;
	}
	input,select{
		border:1px solid #888888;
	}
	input:hover,input:active,select:hover,select:active{
		border:1px solid #aa6666
	}
	input[type=text]{
		padding:2px;
		margin:1px 0;
	}
	#pagebar{
		float:right;
	}
	#search_bar{
		border-width:1px 0;
	}
	#search_bar td{
		padding:1px;
		border-width:0;
	}
	#search_bar tr:hover td{
		background:#fff;
	}
	.bt_button{
    cursor: pointer;
    overflow: visible;
    width: auto;
    background: url("lib/yaml/screen/images/button_gray.png") repeat-x scroll left top #454545;
    border-color: #DDDDDD #444444 #444444 #DDDDDD;
    border-style: solid;
    border-width: 1px;
    color: #000000;
    padding: 5px 1em;	
	}
	.bt_button:hover,.bt_button:active,.bt_button:focus{
    background: none repeat-x scroll left top #555555;
    border-color: #444444 #DDDDDD #DDDDDD #444444;
    color: #ffffff;
	}
	#page_go,#print_search,.bt_act{
		padding:0;
	}
	.chk{
		background-color:#d0d0d0;
	}
	#diaglog_print{
		display:none;
	}
	#lb_search{
		width:5em;
	}
	#bts_search{
		width:9.6em;
		text-align:right;
	}
	#adv_search{
		display:none;
	}
</style>
<script type="text/javascript">
	$(function() {
		$(".datepicker").datepicker();
		$( "#diaglog_print" ).dialog({
			autoOpen: false,
			width:280,
			modal: true,
			//position: 'center',
			buttons: {
				"打印": function() {
					window.open('search_print.asp?'+$("#fm_search").serialize()+'&'+$("#fm_print").serialize(), '_blank', 'height=768px, width=1024px, scrollbars=yes, resizable=yes');
				},
				"取消": function() {
					$(this).dialog( "close" );
				}

			}

		});
		$("#print_search").live('click',function(){
			$( "#diaglog_print" ).dialog("open");
		});
		var p=1;
		function vi(p){
			$.get("search_main.asp?page="+p+"&"+$("#fm_search").serialize(),function(data){	//用ajax的get方式提交
				$("#search_main").html(data);

				$("#pagebar a").click(function(e){	//对分页栏中的a元素进行操作
					e.preventDefault();	//阻止a的原先事件
					vi($(this).attr("id"));	//根据获取的页码值调用显示页面函数
				});
				$("#page_go").click(function(e){	//对分页栏中的input元素进行操作
					e.preventDefault();
					if (isNaN($("#page_val").val())||$.trim($("#page_val").val())==""){	//判断输入的是否是数字
						alert("输入的页码错误，请输入正确页码！");
						$("#page_val").select();
						return false;	//页码值不是数字则退出；
					}
					vi($("#page_val").val());
				});
				var chk=$(".checkid");
				$("#checkall").click(function(){
					chk.attr("checked",$(this).attr("checked"));	//根据全选的checkbox状态来填充单个checkbox状态
					$(this).attr("checked") ? chk.closest("tr").addClass("chk") : chk.closest("tr").removeClass("chk")	//判断是否全部选中，选中则增加chk样式，没选中则删除chk样式，不能用toggleClass方法，由于下面单个checkbox会改变全选的checkbox状态
				});
				chk.click(function(){
					if(!$(this).attr("checked")) $("#checkall").attr("checked",false);	//如果当前checkbox状态为未选中则全选的checkbox也设置为未选中
					$(this).closest("tr").toggleClass("chk");	//单个切换当前checkbox存在的tr的chk样式
				});
				
				$(".bt_act").click(function(){
					$chks=$("#search_main input:checkbox.checkid:checked");
					if(confirm("要对这 "+$chks.length+" 条记录做"+$(this).val()+"操作吗？")){
						var aChk=new Array();
						$chks.each(function(){
							aChk.push($(this).val());
						});
						$.post("batch.asp",{chks:aChk.join(),act:$(this).val()},function(data){
							if(data.bStatus){
								vi($("#page_val").val());
							}else{
								alert(data.sInfo);
							}
						},"json");
					}
				});
				
			});

		}
		
		$("#cd_status").change(function(){
			if($(this).val()==3){
				$("#ytksrq").removeAttr("disabled");
				$("#ytjsrq").removeAttr("disabled");
			}else{
				$("#ytksrq").attr("disabled",true).val("");
				$("#ytjsrq").attr("disabled",true).val("");
			}
		});
		$("#bt_search").click(function(){
			var start_time = new Date().getTime();
			vi(p);
			var end_time = new Date().getTime();
			$("#show_runtime").html(end_time-start_time);
		});
		$("#show_adv").click(function(){
			$("#adv_search").toggle();
		});
		$("#search_bar select").change(function(){
			//console.log($(this).get(0).selectedIndex);
			if($(this).get(0).selectedIndex==0){
				$(this).css('color','black');
			}else{
				$(this).css('color','red');
			}
		});
		$("#search_bar input[type=reset]").click(function(){
			$("#search_bar select").css('color','black');
		});
		
	});
</script>	
<!--#include file="lib/js-google-analytics.asp"-->
</head>
<%
	' if not CheckFlag(session("aaPostflag"),1) then call JumpErrorPage(2)
%>
<body>
<div id="diaglog_print" title="打印查询结果">
	<form id="fm_print" name="fm_print">
		<div class="type-text">
			<label for="print_title">标题</label>
			<input id="print_title" name="print_title" type="text" />
		</div>
		<div class="type-select">
			<label for="search_col">选择打印列</label><br />
			<select id="search_col" name="search_col" multiple="multiple" size="11">
				<%
					for each x in d
				%>
				<option value="<%=x%>"><%=d(x)%></option>
				<%		
					next
				%>
			</select>
		</div>
	</form>
</div>
<!--#include file="lib/header.asp"-->
<!--#include file="lib/nav.asp"-->
<div id="main">

<!--#include file="lib/col1.asp"-->
<!--#include file="lib/col2.asp"-->
	<div id="col3" role="main">
		<div id="col3_content" class="clearfix">
			<form id="fm_search" name="fm_search">
				<table id="search_bar" class="full">
					<tr>
						<td>
							<select id="ym" name="ym">
								<option value="">选择报表</option>
								<%
									Set rs_ym = Server.CreateObject("ADODB.Recordset")
									sql = "SELECT id FROM ym order by id desc"
									rs_ym.Open sql,conn,1,1
									do while not rs_ym.eof
								%>
								<option value="<%=rs_ym("id")%>"><%=rs_ym("id")%></option>
								<%
										rs_ym.movenext
									loop
									rs_ym.close
									set rs_ym=nothing
								%>
							</select>
							<select id="ym" name="ym">
								<option value="">选择国家</option>
								<%
									Set rs_country = Server.CreateObject("ADODB.Recordset")
									sql = "SELECT id,country FROM country"
									rs_country.Open sql,conn,1,1
									do while not rs_country.eof
								%>
								<option value="<%=rs_country("id")%>"><%=rs_country("country")%></option>
								<%
										rs_country.movenext
									loop
									rs_country.close
									set rs_country=nothing
								%>
							</select>
						</td>
						<td id="bts_search">
							<input id="bt_search" class="bt_button" name="bt_submit" type="button" value="搜索" />
							<input class="bt_button" type="reset" value="重置" />
						</td>
					</tr>
				</table>
			</form>
			<div id="search_main"></div>
		</div>
	</div>
</div>
<!--#include file="lib/footer.asp"-->
</body>
</html>
<!--#include file="lib/connclose.asp"-->

